<div class="row">
	<div class="col-sm-12">
		<div class="space"></div>
        
		<table width="100%" class="table table-striped table-bordered table-hover">
			<tr>
			    <th height="30">序号</th>
				<th height="30">用户</th>
				<th height="30">课程分类</th>
				<th height="30">课程列表</th>
				<th height="30">课包</th>
				<th height="30">课时</th>
				<th height="30">预约时间</th>
				<th height="30">留言</th>
				<th height="30">状态</th>
				<th height="30">任课教师</th>
				<th height="30">操作</th>
			</tr>
			<?php if(!empty($book_list)){foreach ($book_list as $key=>$val){?>
			<tr>
			  <td height="30"><?php echo $val['id']?></td>
			  <td height="30"><?php echo $member_list[$val['book_member_id']]['baby_name'];?></td>
			  <td height="30"><?php echo $val['cc_title']?></td>
			  <td height="30"><?php echo $val['c_title']?></td>
			  <td height="30"><?php echo $val['cp_title']?></td>
			  <td height="30"><?php echo $val['book_date']?></td>
			  <td height="30"><?php echo $val['hours']?></td>
			  <td height="30"><?php echo substr_cn($val['message'],0,$substr_num)?></td>
			  <td height="30">
			  <input type="hidden" name="original_<?php echo $val['id']?>" value="<?php echo $val['status'];?>"/>
			  <select onchange="updatestatus(this)" id='<?php echo $val['id']?>'>
			  <?php foreach ($book_status as $key_two=>$val_two){?>
			  	<option value="<?php echo $key_two?>" <?php if($key_two == $val['status'])echo 'selected="selected"'?>><?php echo $val_two?></option>
			  <?php }?>
			  </select>
			  </td>
			  <td height="30"><?php echo $teacher_list[$val['teacher_id']]['name']?></td>
			  <td height="30">
			  <a href='/nursery/book/info?id=<?php echo $val['id']?>&per_page=<?php if(!empty($_REQUEST['per_page']))echo $_REQUEST['per_page']?>'>详情</a>
			  </td>
		  </tr>
		  <?php }}else{?>
			<tr>
			  <td height="30" colspan="13"><div align="center"><?php echo $error;?></div></td>
		  </tr>
		  <?php }?>
	  </table>
		
		<div class="float_right">
			<?php echo $pagelink;?>
		</div>
	</div>
</div>
<script>
/**
 * 修改状态
 */
function updatestatus(object){
	var id = $(object).attr('id');
	var status = $(object).val();
	var original = $("[name='original_"+id+"']").val();
	if(confirm('确定要修改吗？')){
	    $.ajax({
           type: 'get',
           url: '/nursery/book/updatestatus?id='+id+'&status='+status,
           async : false,
           dataType: 'json',
           success: function (d){
    	        if(d['code'] == 10){
    	        	alert(d['msg']);
    	        	$("[name='original_"+id+"']").val(status);
        	    }else{
        	    	alert(d['msg']);
        	    	$(object).val(original);
            	}
           },
    	});
	}else{
		$(object).val(original);
	}
}


















</script>
<!--content-->